
from django.urls import path,re_path,include
from web.views import account,home,project,manage,wiki,file,setting,issues,dashboard,statistics

urlpatterns = [
    # path('admin/', admin.site.urls),
    # path('index/', views.index),
    # path('send/sms/', views.send_sms),
    re_path(r'^register/', account.register,name='register'),
    re_path(r'^send/sms/', account.send_sms, name='send_sms'),

    # 短信登陆
    re_path(r'^login/sms/', account.login_sms, name='login_sms'),
    # 用户名和密码登录
    re_path(r'^login/', account.login, name='login'),
    # 图片验证码
    re_path(r'^image/code/', account.image_code, name='image_code'),

    re_path(r'^register/save/', account.register_save, name='register_save'),

    re_path(r'^index/', home.index, name='index'),

    re_path(r'^logout/', account.logout, name='logout'),
    re_path(r'^price/', home.price, name='price'),
    re_path(r'^payment/(?P<policy_id>\d+)/$', home.payment, name='payment'),
    re_path(r'^pay/$', home.pay, name='pay'),
    re_path(r'^pay/notify$', home.pay_notify, name='pay_notify'),
    # 项目列表
    re_path(r'^project/list/', project.project_list, name='project_list'),
    # 建立星标连接，如果是我创建的项目则url为：/web/project/star/my/2，我参与的项目url为：/web/project/star/join/5
    # 这样传递两个参数后，视图函数的参数必须写为：project_star(request,project_type,project_id)
    re_path(r'^project/star/(?P<project_type>\w+)/(?P<project_id>\d+)/$', project.project_star, name='project_star'),
    re_path(r'^project/unstar/(?P<project_type>\w+)/(?P<project_id>\d+)/$', project.project_unstar, name='project_unstar'),

    # 项目管理
    # re_path(r'^manager/(?P<project_id>\d+)/dashboard/$', project.project_dashboard, name='project_dashboard'),
    # re_path(r'^manager/(?P<project_id>\d+)/issues/$', project.project_issues, name='project_issues'),
    # re_path(r'^manager/(?P<project_id>\d+)/statistics/$', project.project_statistics, name='project_statistics'),
    # re_path(r'^manager/(?P<project_id>\d+)/file/$', project.project_file, name='project_file'),
    # re_path(r'^manager/(?P<project_id>\d+)/wiki/$', project.project_wiki, name='project_wiki'),
    # re_path(r'^manager/(?P<project_id>\d+)/setting/$', project.project_setting, name='project_setting'),

    re_path(r'^manager/(?P<project_id>\d+)/', include([

        # re_path(r'^issues/$', manage.issues, name='issues'),
        re_path(r'^wiki/$', wiki.wiki, name='wiki'),
        re_path(r'^wiki/add/$', wiki.wiki_add, name='wiki_add'),
        re_path(r'^wiki/catalog/$', wiki.wiki_catalog, name='wiki_catalog'),
        # re_path(r'^wiki/detail/$', wiki.wiki_detail, name='wiki_detail'),
        re_path(r'^wiki/delete/(?P<wiki_id>\d+)/$', wiki.wiki_delete, name='wiki_delete'),
        re_path(r'^wiki/edit/(?P<wiki_id>\d+)/$', wiki.wiki_edit, name='wiki_edit'),
        re_path(r'^wiki/upload/$', wiki.wiki_upload, name='wiki_upload'),

        ## 文件夹的管理
        re_path(r'^file/$', file.file, name='file'),
        re_path(r'^file/delete/$', file.file_delete, name='file_delete'),
        re_path(r'^file/post/$', file.file_post, name='file_post'),
        re_path(r'^file/download/(?P<file_id>\d+)/$', file.file_download, name='file_download'),

        re_path(r'^cos/cos_credential/$', file.cos_credential, name='cos_credential'),

        re_path(r'^setting/$', setting.setting, name='setting'),
        re_path(r'^setting/delete/$', setting.delete, name='setting.delete'),

        # 问题
        re_path(r'^issues/$', issues.issues, name='issues'),
        re_path(r'^issues/detail/(?P<issues_id>\d+)$', issues.issues_detail, name='issues_detail'),
        re_path(r'^issues/record/(?P<issues_id>\d+)$', issues.issues_record, name='issues_record'),
        re_path(r'^issues/change/(?P<issues_id>\d+)$', issues.issues_change, name='issues_change'),
        re_path(r'^issues/invite/url/$', issues.invite_url, name='invite_url'),
        re_path(r'^issues/invite/url/$', issues.invite_url, name='invite_url'),

        re_path(r'^dashboard/$', dashboard.dashboard, name='dashboard'),
        re_path(r'^dashboard/issues/chart/$', dashboard.issues_chart, name='issues_chart'),

        re_path(r'^statistics/$', statistics.statistics, name='statistics'),
        re_path(r'^statistics/priority/$', statistics.statistics_priority, name='statistics_priority'),
        re_path(r'^statistics/project/user/$', statistics.statistics_project_user, name='statistics_project_user'),

            ],None)),

        re_path(r'^invite/join/(?P<code>\w+)$', issues.invite_join, name='invite_join'),

]








